package parallels.servertech.server.nio.event;

import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;

public class ChannelEvent {
	private final ChannelEventDispatcher dispatcher;
	private final ChannelEventType type;
	private final SocketChannel channel;
	private final SelectionKey selectionKey;
	
	public enum ChannelEventType {
		CHANNEL_READY_FOR_READING, INPUT_BUFFER_READY_FOR_FILLING, INPUT_BUFFER_FILLED, OUTPUT_BUFFER_READY_FOR_DRAINING, CHANNEL_READY_FOR_WRITING, OUTPUT_BUFFER_DRAINED
	}
	
	public ChannelEvent(ChannelEventDispatcher dispatcher, ChannelEventType type, SocketChannel channel, SelectionKey selectionKey) {
		this.dispatcher = dispatcher;
		this.type = type;
		this.channel = channel;
		this.selectionKey = selectionKey;
	}

	public ChannelEventType getType() {
		return type;
	}

	public SocketChannel getChannel() {
		return channel;
	}

	public ChannelEventDispatcher getEventDispatcher() {
		return dispatcher;
	}

	public SelectionKey getSelectionKey() {
		return selectionKey;
	}
}
